package com.xw.childhealth.util;


import com.xw.childhealth.VO.ResultVO;
import com.xw.childhealth.enums.ResultEnum;

/**
 * @Description:
 * @Author: y
 * @CreateDate: 2019-11-06 09:22
 * @Version: 1.0
 */
public class ResultVOUtil {

    public static ResultVO success() {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(0);
        resultVO.setMsg("ok");
        return resultVO;
    }


    public static ResultVO success(Object o) {
        return success().setData(o);
    }


    public static ResultVO error(Integer code, String msg) {
        ResultVO resultVO = new ResultVO();
        resultVO.setMsg(msg);
        resultVO.setCode(code);
        return resultVO;
    }

    public static ResultVO error(ResultEnum resultEnum) {
        return error(resultEnum.getCode(), resultEnum.getMsg());
    }

    public static ResultVO error(String msg) {
        return error(-1, msg);
    }
}
